<template>
  <div>
    <Breadcrumb>
      <BreadcrumbItem>订单管理</BreadcrumbItem>
      <BreadcrumbItem>非友好购物管理</BreadcrumbItem>
    </Breadcrumb>
    <Form ref="formInline" :model="request" inline>
      <FormItem>
        订单编号：<Input
        type="text"
        clearable
        style="width: 120px"
      />
      </FormItem>
      <FormItem>
        活动编号: <Input
        type="text"
        clearable
        style="width: 120px"
      />
      </FormItem>
      <FormItem>
        设备编号：<Input
        type="text"
        clearable
        style="width: 120px"
      />
      </FormItem><br>
      <FormItem>
        支付方式：<Select  placeholder="请选择" style="width: 120px;">
        <Option value="0">支付宝</Option>
        <Option value="1">微信</Option>
      </Select>
      </FormItem><br>
      <FormItem>
        创建时间: <DatePicker
        type="daterange"
        @on-change="timechange"
        :transfer="true"
        placement="bottom-end"
        placeholder="请选择开始-结束时间"
        style="width: 200px"
      ></DatePicker>
      </FormItem>
      <FormItem>
        手机号: <Input
        type="text"
        clearable
        style="width: 120px"
      />
      </FormItem>
      <FormItem>
        <Button type="primary" @click="search" style="margin-right: 10px"
        >搜索</Button
        >
      </FormItem>
    </Form>
    <div>
      <div style="line-height: 20px;">
        <h4>非友好购物订单说明:</h4>
        <div><p class="addBold">非友好购物行为：</p><span>非友好购物行为会触发处罚机制，罚款金额由商家配置，主要用于威慑部分恶意消费者。和消费者沟通清楚后，可以退款。</span></div>
        <div><p class="addBold">触发机制：</p><span>1、遮挡摄像头或者商品；<br></span><span>2、放入异物，偷吃等。</span></div>
        <div><p class="addBold">商家处理：</p><span>1、您可以点击审核，查看监控视频或图片后，主动发起退款。</span><br><span>2、您可以不做任何处理。</span></div>
      </div><br>
      <Table border :columns="columns2" :data="data2"></Table>
    </div>
    <div style="display: flex; justify-content: center; margin-top: 24px">
      <Page style="display: flex;justify-content: center;margin-top: 24px;" :total="page.count" :page-size="20" :page-size-opts="[20,30,40,50,100]" show-elevator show-sizer show-total
            @on-change="handleCurrentChange" @on-page-size-change="handleSizeChange" />
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        request: {
          name: '',
          loading: false
        },
        columns2: [
          {
            title: '订单编号',
            key: 'order_id'
          },
          {
            title: '活动编号',
            key: 'activity_id'
          },
          {
            title: '设备编号',
            key: 'device_id'
          },
          {
            title: '手机号',
            key: 'phone'
          },
          {
            title: '订单金额',
            key: 'order_money'
          },
          {
            title: '支付方式',
            key: 'order_ways'
          },
          {
            title: '创建时间',
            key: 'pay_times'
          },
          {
            title: '支付时间',
            key: 'pay_times'
          },
          {
            title: '操作',
            key: 'option'
          }
        ],
        data2: [
          {
            order_id: '001',
            activity_id: '12345',
            device_id: '356',
            option:'123'
          }

        ],
        params: {
          device_time: [],
          status: 1,
          user_id: "",
          order_id: "",
          activity_id: "",
          page: 1,
          limit: 10,
        },
        total: 0,
        page: {},
        height: this.$store.state.height,
        modal1: false,
        modal2: false,
        modal3: false,
        data1: [
          {
            id: 1,
            title: "机器组3",
          },
          {
            id: 2,
            title: "机器组4",
          },
        ],
        request: {
          device_number: "",
          page: 1,
        },
        tableData: [],
        role_id:null,
      };
    },
    mounted() {

      this.init();
    },
    methods: {
      findVideo(){
        this.cancel();
        this.modal3 = true
        this.allocated = [];
        this.undistributed = [];
        if(this.infoID == 6){
          console.log('6')
          this.axios.post("device/getAllDev").then(res => {
            if (res.code == 1) {
              this.allocated = res.data.allocated;
              this.undistributed= res.data.undistributed;
            }
          });

        }
      },
      init(){
        this.axios.post('shop/shop_list').then((res) => {
          if (res.code === 1) {
            console.log(res)
            this.total = res.data.count
            this.tableData = res.data.list
          }
        })
      },
      // goDel(id) {
      //   this.$router.push({ path: "/order/detail", query: { id } });
      // },
      search() {
        this.params.page = 1;
        this.init();
      },
      confirm() {
        this.modal1 = false;
        this.$Message.success("保存成功！");
        this.cancel();
      },
      cancel() {},
      add() {
        this.modal1 = true;
      },
      setStatus(id, status) {
        var text = "确定要" + (status == 1 ? "启用" : "禁用") + "此机器组么？";
        this.$Modal.confirm({
          title: text,
          onOk: () => {
            this.$Message.success("操作成功");
          },
          onCancel: () => {},
        });
      },
      timechange(val) {
        console.log(val);
      },
      handleSizeChange(val) {
        this.request.page = 1;
        this.request.limit = val;
        this.lists();
      },
      handleCurrentChange(val) {
        this.params.page = val;
        this.init();
      },
      // 测试门店列表
      lists () {
        this.loading = true
        // console.log( JSON.parse(this.astgo.getItem(this.Pn + "info")).role_id )
        // this.request.id = JSON.parse(this.astgo.getItem(this.Pn + "info")).role_id;
        this.axios.post('shop/shop_list', this.request).then(res => {
          if (res.code === 1) {
            this.loading = false
            this.tableData = res.data.list
            this.page.count = res.data.count // 总条数
            this.page.curPage = res.data.curPage // 当前页
            this.page.countPage = res.data.countPage // 总页数
            console.log('this.tableData', this.tableData)
          }
        })
      },




      changeUserMsg(item, type) {
        console.log("现在的type", type);
        this.type = type;
        if (type == 1) {
          this.title = "编辑";
          this.addformInline.title = item.title;
          this.addformInline.remarks = item.remarks;
          this.addformInline.id = item.id;
          this.addUserOrChange = true;

        } else if (type == 2) {

          if (this.addformInline.id) {
            this.addformInline.id =null;
          }

          this.title = "添加";
          this.$Modal.confirm({
            title: "确定要添加角色？",
            onOk: () => {
              this.addUserOrChange = true;
            },
            onCancel: () => {}
          });
        }
      },
    },
  };
</script>

<style>
  *{
    margin: 0;
    padding: 0;
  }
  .addBold{
    font-weight: bold;

  }

</style>
